/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Prestashop_saver;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author strokyl
 */
@Entity
@Table(name = "ps_customer")
public class PsCustomer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_customer", nullable = false)
    private Integer idCustomer;
    @Basic(optional = false)
    @Column(name = "id_shop_group", nullable = false)
    private int idShopGroup;
    @Basic(optional = false)
    @Column(name = "id_shop", nullable = false)
    private int idShop;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_gender", nullable = false)
    private PsGender gender;


    @Basic(optional = false)
    @Column(name = "id_default_group", nullable = false)
    private int idDefaultGroup;
    @Column(name = "id_lang")
    private Integer idLang;
    @Basic(optional = false)
    @Column(name = "id_risk", nullable = false)
    private int idRisk;
    @Column(name = "company", length = 64)
    private String company;
    @Column(name = "siret", length = 14)
    private String siret;
    @Column(name = "ape", length = 5)
    private String ape;
    @Basic(optional = false)
    @Column(name = "firstname", nullable = false, length = 32)
    private String firstname;
    @Basic(optional = false)
    @Column(name = "lastname", nullable = false, length = 32)
    private String lastname;
    @Basic(optional = false)
    @Column(name = "email", nullable = false, length = 128)
    private String email;
    @Basic(optional = false)
    @Column(name = "passwd", nullable = false, length = 32)
    private String passwd;
    @Basic(optional = false)
    @Column(name = "last_passwd_gen", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastPasswdGen;
    @Column(name = "birthday")
    @Temporal(TemporalType.DATE)
    private Date birthday;
    @Basic(optional = false)
    @Column(name = "newsletter", nullable = false)
    private boolean newsletter;
    @Column(name = "ip_registration_newsletter", length = 15)
    private String ipRegistrationNewsletter;
    @Column(name = "newsletter_date_add")
    @Temporal(TemporalType.TIMESTAMP)
    private Date newsletterDateAdd;
    @Basic(optional = false)
    @Column(name = "optin", nullable = false)
    private boolean optin;
    @Column(name = "website", length = 128)
    private String website;
    @Basic(optional = false)
    @Column(name = "outstanding_allow_amount", nullable = false, precision = 20, scale = 6)
    private BigDecimal outstandingAllowAmount;
    @Basic(optional = false)
    @Column(name = "show_public_prices", nullable = false)
    private boolean showPublicPrices;
    @Basic(optional = false)
    @Column(name = "max_payment_days", nullable = false)
    private int maxPaymentDays;
    @Basic(optional = false)
    @Column(name = "secure_key", nullable = false, length = 32)
    private String secureKey;
    @Lob
    @Column(name = "note", length = 65535)
    private String note;
    @Basic(optional = false)
    @Column(name = "active", nullable = false)
    private boolean active;
    @Basic(optional = false)
    @Column(name = "is_guest", nullable = false)
    private boolean isGuest;
    @Basic(optional = false)
    @Column(name = "deleted", nullable = false)
    private boolean deleted;
    @Basic(optional = false)
    @Column(name = "date_add", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateAdd;
    @Basic(optional = false)
    @Column(name = "date_upd", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateUpd;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
    private Set<PsOrders> orders;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
    private Set<PsAddress> addresses;

    public PsCustomer() {
    }

    public PsCustomer(Integer idCustomer) {
        this.idCustomer = idCustomer;
    }

    public PsCustomer(Integer idCustomer, int idShopGroup, int idShop, PsGender gender, int idDefaultGroup, int idRisk, String firstname, String lastname, String email, String passwd, Date lastPasswdGen, boolean newsletter, boolean optin, BigDecimal outstandingAllowAmount, boolean showPublicPrices, int maxPaymentDays, String secureKey, boolean active, boolean isGuest, boolean deleted, Date dateAdd, Date dateUpd, Set<PsOrders> orders, Set<PsAddress> addresses) {
        this.idCustomer = idCustomer;
        this.idShopGroup = idShopGroup;
        this.idShop = idShop;
        this.gender = gender;
        this.idDefaultGroup = idDefaultGroup;
        this.idRisk = idRisk;
        this.firstname = firstname;
        this.lastname = lastname;
        this.email = email;
        this.passwd = passwd;
        this.lastPasswdGen = lastPasswdGen;
        this.newsletter = newsletter;
        this.optin = optin;
        this.outstandingAllowAmount = outstandingAllowAmount;
        this.showPublicPrices = showPublicPrices;
        this.maxPaymentDays = maxPaymentDays;
        this.secureKey = secureKey;
        this.active = active;
        this.isGuest = isGuest;
        this.deleted = deleted;
        this.dateAdd = dateAdd;
        this.dateUpd = dateUpd;
        this.orders = orders;
        this.addresses = addresses;
    }

    public Integer getIdCustomer() {
        return idCustomer;
    }

    public void setIdCustomer(Integer idCustomer) {
        this.idCustomer = idCustomer;
    }

    public int getIdShopGroup() {
        return idShopGroup;
    }

    public void setIdShopGroup(int idShopGroup) {
        this.idShopGroup = idShopGroup;
    }

    public int getIdShop() {
        return idShop;
    }

    public void setIdShop(int idShop) {
        this.idShop = idShop;
    }

    public PsGender getGender() {
        return gender;
    }

    public void setGender(PsGender gender) {
        this.gender = gender;
    }

    public int getIdDefaultGroup() {
        return idDefaultGroup;
    }

    public void setIdDefaultGroup(int idDefaultGroup) {
        this.idDefaultGroup = idDefaultGroup;
    }

    public Integer getIdLang() {
        return idLang;
    }

    public void setIdLang(Integer idLang) {
        this.idLang = idLang;
    }

    public int getIdRisk() {
        return idRisk;
    }

    public void setIdRisk(int idRisk) {
        this.idRisk = idRisk;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getSiret() {
        return siret;
    }

    public void setSiret(String siret) {
        this.siret = siret;
    }

    public String getApe() {
        return ape;
    }

    public void setApe(String ape) {
        this.ape = ape;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPasswd() {
        return passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    public Date getLastPasswdGen() {
        return lastPasswdGen;
    }

    public void setLastPasswdGen(Date lastPasswdGen) {
        this.lastPasswdGen = lastPasswdGen;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public boolean getNewsletter() {
        return newsletter;
    }

    public void setNewsletter(boolean newsletter) {
        this.newsletter = newsletter;
    }

    public String getIpRegistrationNewsletter() {
        return ipRegistrationNewsletter;
    }

    public void setIpRegistrationNewsletter(String ipRegistrationNewsletter) {
        this.ipRegistrationNewsletter = ipRegistrationNewsletter;
    }

    public Date getNewsletterDateAdd() {
        return newsletterDateAdd;
    }

    public void setNewsletterDateAdd(Date newsletterDateAdd) {
        this.newsletterDateAdd = newsletterDateAdd;
    }

    public boolean getOptin() {
        return optin;
    }

    public void setOptin(boolean optin) {
        this.optin = optin;
    }

    public String getWebsite() {
        return website;
    }

    public void setWebsite(String website) {
        this.website = website;
    }

    public BigDecimal getOutstandingAllowAmount() {
        return outstandingAllowAmount;
    }

    public void setOutstandingAllowAmount(BigDecimal outstandingAllowAmount) {
        this.outstandingAllowAmount = outstandingAllowAmount;
    }

    public boolean getShowPublicPrices() {
        return showPublicPrices;
    }

    public void setShowPublicPrices(boolean showPublicPrices) {
        this.showPublicPrices = showPublicPrices;
    }

    public int getMaxPaymentDays() {
        return maxPaymentDays;
    }

    public void setMaxPaymentDays(int maxPaymentDays) {
        this.maxPaymentDays = maxPaymentDays;
    }

    public String getSecureKey() {
        return secureKey;
    }

    public void setSecureKey(String secureKey) {
        this.secureKey = secureKey;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public boolean getIsGuest() {
        return isGuest;
    }

    public void setIsGuest(boolean isGuest) {
        this.isGuest = isGuest;
    }

    public boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(boolean deleted) {
        this.deleted = deleted;
    }

    public Date getDateAdd() {
        return dateAdd;
    }

    public void setDateAdd(Date dateAdd) {
        this.dateAdd = dateAdd;
    }

    public Date getDateUpd() {
        return dateUpd;
    }

    public void setDateUpd(Date dateUpd) {
        this.dateUpd = dateUpd;
    }

    public Set<PsAddress> getAddresses() {
        return addresses;
    }

    public void setAddresses(Set<PsAddress> addresses) {
        this.addresses = addresses;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCustomer != null ? idCustomer.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PsCustomer)) {
            return false;
        }
        PsCustomer other = (PsCustomer) object;
        if ((this.idCustomer == null && other.idCustomer != null) || (this.idCustomer != null && !this.idCustomer.equals(other.idCustomer))) {
            return false;
        }
        return true;
    }

    public Set<PsOrders> getOrders() {
        return orders;
    }

    public void setOrders(Set<PsOrders> orders) {
        this.orders = orders;
    }

    @Override
    public String toString() {
        return "hibernate.PsCustomer[idCustomer=" + idCustomer + "]";
    }

}
